﻿using Sustainalytics.Entities;
using System;
using System.Globalization;

namespace Sustainalytics.FTPReport.BusinessLogic
{
    public class FtpClientReportDto
    {
        public Guid Id { get; set; }

        public Guid AccountId { get; set; }

        public Guid ReportId { get; set; }

        public FrequencyEnum Frequency { get; set; }

        public DateTime? LastGeneratedDate { get; set; }

        public string NextGenerationDate { get; set; }


        public static FtpClientReport ToFtpClientReportEntity(FtpClientReportDto input)
        {

            return new FtpClientReport
            {
                Id = input.Id,
                AccountId = input.AccountId,
                ReportId = input.ReportId,
                Frequency = input.Frequency,
            };
        }

        public static FtpClientReportDto ToFtpClientReportDto(FtpClientReport input)
        {

            return new FtpClientReportDto
            {
                Id = input.Id,
                AccountId = input.AccountId,
                ReportId = input.ReportId,
                Frequency = input.Frequency,                
                NextGenerationDate = (input.NextGenerationDate != null)?  input.NextGenerationDate.ToString("d",  CultureInfo.CreateSpecificCulture("en-US")) : String.Empty
            };
        }
    }



    public enum ReportTypeEnum
    {
        Report = 1,
        Filter = 2
    }


}
